import React from 'react';

import styles from './ApplicationTable.less';

export default ({ columns, dataSource }) => (
    <table className={styles.table}>
        <tbody>
            <tr>
                {columns.map(item => (
                    <th key={item.key}>{item.label}</th>
                ))}
            </tr>
            {dataSource.map(record => (
                <tr key={record.id}>
                    {columns.map(item => (
                        <td key={`${record.id}${item.key}`}>{record[item.key]}</td>
                    ))}
                </tr>
            ))}
        </tbody>
    </table>
);
